//
//  main.c
//  104. maxDepth
//
//  Created by edz on 2020/7/11.
//  Copyright © 2020 edz. All rights reserved.
//

#include <stdio.h>


// Definition for a binary tree node.
struct TreeNode {
    int val;
    struct TreeNode *left;
    struct TreeNode *right;
};


int maxDepth(struct TreeNode* root){
    if (root == NULL) {
        return 0;
    }
    int countleft = 1 , countright = 1;
    if (root->left) {
        countleft += maxDepth(root->left);
    }
    if (root->right) {
        countright += maxDepth(root->right);
    }
    return countleft > countright ? countleft : countright;
}
